package top.yxqz.resultMap;

import org.apache.ibatis.annotations.*;
import top.yxqz.mybatis.resultmap.pojo.Emp;

import java.util.List;

/**
 * @author: 余小小
 * @date: 2023/3/29
 * @description： 员工接口
 */
public interface EmpMapper {

    /**
     * 通过部门id得到多个员工
     * 一对多关系实现的第二步
     *        <id property="empId" column="emp_id"></id>
     *         <result property="empName" column="emp_name"></result>
     *         <result property="gender" column="gender"></result>
     *         <result property="age" column="age"></result>
     * @param deptId
     * @return
     */
    @Select("select * from t_emp where dept_id = #{deptId} ;")
    @Results({
            @Result(property = "empId", column = "emp_id",id = true),
            @Result(property = "empName", column = "emp_name"),
            @Result(property = "gender", column = "gender"),
            @Result(property = "age", column = "age"),
    })
    List<Emp> getEmpsByDeptId(@Param("deptId") Integer deptId);
}
